local tongge_active = fk.CreateSkill {
  name = "#inker_tongge_active",
}

tongge_active:addEffect("active", {
  name = "#inker_tongge_active",
  prompt = function(self, player, selected_cards, selected_targets)
    local number = self.number
    local to = self.tos[1]
    local num = 0
    for _, cid in ipairs(selected_cards) do
      num = num + Fk:getCardById(cid).number
    end
    return "#inker_tongge-invokemark:" .. to.id .. "::" .. number .. ":" .. num .. ":" .. ((num == 0 and 1 or math.ceil(num / number)) * number)
  end,
  min_card_num = 1,
  card_filter = function(self, player, to_select, selected)
    return not player:prohibitDiscard(to_select)
  end,
  target_num = 0,
  target_filter = Util.FalseFunc,
  feasible = function(self, player, selected, selected_cards, card)
    if #selected_cards == 0 then return false end
    local num = 0
    for _, cid in ipairs(selected_cards) do
      num = num + Fk:getCardById(cid).number
    end
    return num % self.number == 0
  end,
  on_cost = function(self, player, data, extra_data)
    return { tos = extra_data.tos }
  end
})

Fk:loadTranslationTable{
  ["#inker_tongge-invoke"] = "同戈：你可以弃置任意张点数和为 %arg 的倍数的牌，令 %src 将手牌补至四张。",

  ["#inker_tongge-invokemark"] = "同戈：你可以弃置任意张点数和（当前为%arg2/%arg3）为 %arg 的倍数的牌，令 %src 将手牌补至四张。",
}

return tongge_active